<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

   <video id="v1"></video>
<script>
    navigator.mediaDevices.getUserMedia({video:true,audio:true})
        .then(function(s){v1.srcObject = s;v1.play();});

    ////web rtc 调用摄像头(兼容性写法(谷歌、火狐、ie))

    //navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia;


</script> 
</body>
</html>